package com.yt.demo.service.feign;

import com.yt.demo.dto.BaseReq;
import com.yt.demo.dto.BaseResp;
import com.yt.demo.service.feign.fallback.FeignHelloServiceHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(name = "demo-hello", contextId = "feign-hello", path = "/hello", fallbackFactory = FeignHelloServiceHystrix.class)
public interface FeignHelloService {

    @RequestMapping(value = "/testGet", method = RequestMethod.GET)
    BaseResp<String> testGet(@RequestParam("param") String param);

    @RequestMapping(value = "/testPost", method = RequestMethod.POST)
    BaseResp<String> testPost(@RequestBody BaseReq<String> req);

    @RequestMapping(value = "/testFile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    BaseResp<String> testFile(@RequestPart("file") MultipartFile file);

}
